while ((str = readline())) {
  const arr = str.split(';')
  const op = ['A', 'W', 'S', 'D']

  let start = [0, 0]
  arr.forEach((item, index) => {
    const flag = item[0]
    const num = Number(item.substring(1))
    if (op.includes(flag) && Number.isInteger(num)) {
      flag === 'A'
        ? (start[0] -= num)
        : flag === 'W'
        ? (start[1] += num)
        : flag === 'D'
        ? (start[0] += num)
        : (start[1] -= num)
    }
  })
  console.log(start.join(','))
}
